﻿using System.IO;
using UnityEditor;
using UnityEngine;

public class InternalCompile
{
    [MenuItem("Tool/My Compile")]
    private static void DoMyCompile()
    {
        string[] sources = new[] { "Assets/bundle/bundle_highlevel/scripts/BundleInit.cs" ,"Assets/bundle/bundle_highlevel/scripts/CardMono.cs"};
        string[] references = new string[0];
        string[] defines = new string[0];
        string outputFile = Path.Combine("Assets/bundle/bundle_highlevel/test.dll");

        string[] msgs = EditorUtility.CompileCSharp(sources, references, defines, outputFile);
        foreach (var msg in msgs)
        {
            Debug.Log(msg);
        }

        string dllFile = "Assets/bundle/bundle_highlevel/test.dll";
        if (File.Exists(dllFile))
        {
            AssetDatabase.ImportAsset(dllFile, ImportAssetOptions.ForceUpdate);
        }
    }
}
